package com.JDK.ThreadPoolExecutor;

import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;

public class MyTask implements Callable<Result>{


    AtomicInteger inc;

    Integer id;

    Callable<Result> callable;

    public MyTask(AtomicInteger inc, int id){
        this.inc = inc;
        this.id = id;
    }


    @Override
    public Result call() throws Exception {
        Long start = System.currentTimeMillis();
        Thread.sleep(this.id);
        Long end = System.currentTimeMillis();
        Long time = end - start;
        return new Result(time, inc.incrementAndGet(), id);
    }



}
